import json

import requests
v1 = "http://localhost:8080/api/v1/"
def get_token(user="admin",password="admin@123"):
    res = requests.post(v1 + "login", json={"username": user, "password": password})
    res = json.loads(res.text)
    return res['token']


def test_create_user():
    res = requests.post(v1 + "user", json={"username": "ren", "password": "admin@123"},headers={"token":get_token()})
    print(res.text)


def test_get_users():
    res = requests.get(v1 + "user",headers={"token":get_token()})
    print(res.text)


# test_create_user()